package com.wangyp.tower.common.exception;

import com.wangyp.tower.common.result.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: Wangyp
 * @Date: 2021/4/27 11:58
 * @Description: *
 */
@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result error(Exception e) {
        e.printStackTrace();
        return Result.fail();
    }

    @ExceptionHandler(TowerException.class)
    @ResponseBody
    public Result error(TowerException e) {
        e.printStackTrace();
        return Result.fail();
    }
}
